﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace weba
{
    public partial class hty : System.Web.UI.Page
    {
        sjklqDataContext sj = new sjklqDataContext();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string pt = FileUpload1.FileName;
            string location1 = Server.MapPath("Images/") + pt;
            FileUpload1.SaveAs(location1);
            Category ct = new Category() { id = (sj.Category.Count() + 1).ToString(), visible = CheckBox1.Checked, title = C1InputText2.Text, description = C1InputText3.Text, imageUrl =pt, imageAltText = C1InputText5.Text, parentCategoryId = DropDownList1.SelectedValue, displayOrder = sj.Category.Count() + 1 };
            sj.Category.InsertOnSubmit(ct);
            sj.SubmitChanges();
          //  System.Web.UI.ScriptManager.RegisterStartupScript(Button1, this.GetType(), "alert", "$(function(){alert('添加成功');})", true);
            Label1.Text = "添加成功";
        }

       
    }
}